package com.ktjiaoyu.demo.web;

import com.ktjiaoyu.demo.comm.DemoInfo;
import com.ktjiaoyu.demo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@EnableConfigurationProperties(DemoInfo.class)
@RestController
public class HelloController {
    @Resource
    private DemoInfo demoInfo;
    @Autowired
    private DemoService demoService;

    @RequestMapping("/hello")
    public String hello() {
        String msg = demoService.sayHello();
        msg += " " + demoInfo.getName() + " " + demoInfo.getEmail();
        return msg;
    }
}
